/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jserver.gameserver.network.serverpackets;

/**
 * @author ASUS
 */
public class ExBrBuyProduct extends L2GameServerPacket
{
	
	public static enum ResultCode{
		/**
		 * success
		 */
		RESULT_SUCCESS(1),
		
		/**
		 * Not enough game points
		 */
		RESULT_NOT_ENOUGH_POINT(-1),
		
		/**
		 * Wrong MallItem
		 */
		RESULT_WRONG_PRODUCT(-2),//also -5
		
		/**
		 * Inventory is full
		 */
		RESULT_INVENTORY_FULL(-4),
		
		/**
		 * sale for NO starting
		 */
		RESULT_SALE_NO_START(-7),
		
		/**
		 * sale for ending
		 */
		RESULT_SALE_END(-8),
		
		/**
		 * state of user Wrong
		 */
		RESULT_WRONG_USER_STATE(-9),// also -11
		
		/**
		 * item of mallitem Wrong
		 */
		RESULT_WRONG_PRODUCT_ITEM(-10),
		
		/**
		 * Wrong time
		 */
		RESULT_WRONG_SALE_TIME(-13),
		
		/**
		 * stock of mallitem is exhaust.
		 */
		RESULT_NOT_ENOUGH_STOCK(-14);
		
		private int code;
		private ResultCode(int code){
			this.code = code;
		}
		
		/**
		 * @return the code
		 */
		public int getCode() {
			return code;
		}
	}
	
	private final ResultCode _code;
	
	public ExBrBuyProduct(ResultCode code)
	{
		_code = code;
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket#writeImpl()
	 */
	@Override
	protected void writeImpl()
	{
		writeC(0xFE);
		writeH(0xD9);
		writeD(_code.getCode());
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket#getType()
	 */
	@Override
	public String getType()
	{
		return "[S] FE:D9 ExBrBuyProduct";
	}
	
}
